v = [1 2 3 4 5 6];
u = perms(v);
u7 = [u u(:,1)];
A = [N 12  N  N  9 16;
    12  N 19 12  N 15;
     N 19  N 21  N 17; 
     N 12 21  N 10 16;
     9  N  N 10  N 10;
    16 15 17 16 10  N];

%%TSP solution exhausive

% for i=1:length(u(:,1))
%     s(i) = 0; 
%     for j=1:6 
%         s(i) = s(i) + A(u(i,j),u7(i,j+1));
%     end
% end
% [smin,sminindex] = min(s(601:720));
% sequence = u7(600+sminindex,:)


%% TRP solution exhausive

for i=1:length(u(:,1))
    s(i) = 0; 
    for j=1:6 
        s(i) = s(i) + (7-j)*A(u(i,j),u7(i,j+1));
    end
end
[smin,sminindex] = min(s(601:720));
sequence = u7(600+sminindex,:)
